package com.chengqs.dfs.datanode.server;

/**
 * <B>主类名称：</B>DataNode<BR>
 * <B>概要说明：</B>DataNode启动类<BR>
 *
 * @author: chengqs
 * @create: 2025-03-30 03:45:08
 **/
public class DataNode {
    /**
     * 是否还在运行
     */
    private volatile Boolean shouldRun;
    /**
     * 负责跟一组NameNode通信的组件
     */
    private NameNodeOfferService offerService;

    /**
     * 初始化DataNode
     */
    private void initialize() {
        this.shouldRun = true;
        this.offerService = new NameNodeOfferService();
        this.offerService.start();
    }

    /**
     * 运行DataNode
     */
    private void run() {
        try {
            while(shouldRun) {
                Thread.sleep(1000);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        DataNode datanode = new DataNode();
        datanode.initialize();
        datanode.run();
    }
}
